package com.niuwa.p2p.utils.schedule;

import org.apache.log4j.Logger;
import org.quartz.SchedulerException;
import org.quartz.listeners.SchedulerListenerSupport;
import org.springframework.stereotype.Component;

/**
 * 
 * @title 调度监听器
 *
 * @author tennyqin
 * @version 1.0
 * @created 2015年3月26日
 */
@Component(value = "startJobSchedulerListener")
public class StartJobSchedulerListener extends SchedulerListenerSupport {

	private static Logger logger = Logger
			.getLogger(StartJobSchedulerListener.class);

	private SchedulerHelper schedulerHelper;

	@Override
	public void schedulerStarted() {
		try {
			schedulerHelper.createActiveJobFromDB();
		} catch (SchedulerException e) {
			logger.error("createActiveJobFromDB", e);
		}
	}

	public SchedulerHelper getSchedulerHelper() {
		return schedulerHelper;
	}

	public void setSchedulerHelper(SchedulerHelper schedulerHelper) {
		this.schedulerHelper = schedulerHelper;
	}

}